package com.project.entity.activity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import com.project.entity.enumcommon.AuditStatusEnum;
import com.project.entity.sys.Area;
import com.project.entity.user.BaseUser;
import com.project.entity.user.User;

/**
 * @author ma.peilin
 *
 */
@Entity
@Table(name="B_ACTIVITY_USER")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@DynamicInsert
@DynamicUpdate
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)//每个类一张表：
public class ActivityUser extends BaseUser{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4644177483690063409L;

	@Column(name="user_id")
	private Long userId;//用户id

	@Column(name="activity_id")
	private Long activityId;//活动id
	
	@Column(name="audit_status")
	@Enumerated(EnumType.STRING)
	private AuditStatusEnum auditStatus;//审核状态（W:待审核;P:已通过;N:未通过;C.已取消）
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="audit_time")
	private Date auditTime;//审核时间
	
	@Column(name="audit_user")
	private String auditUser;//审核人员
	
	@Column(name="audit_description")
	private String auditDescription;//审核说明
	
	@Column(name="cancel_reason")
	private String cancelReason;//取消原因
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="cancel_time")
	private Date cancelTime;//取消时间
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="application_time")
	private Date applicationTime;//申请时间


	@OneToOne(fetch=FetchType.LAZY,cascade=CascadeType.REFRESH)
	@JoinColumn(name="province",referencedColumnName="code",updatable=false,insertable=false)
	private Area provinceEntity;
	
	@OneToOne(fetch=FetchType.LAZY,cascade=CascadeType.REFRESH)
	@JoinColumn(name="city",referencedColumnName="code",updatable=false,insertable=false)
	private Area cityEntity;
	
	@OneToOne(fetch=FetchType.LAZY,cascade=CascadeType.REFRESH)
	@JoinColumn(name="district",referencedColumnName="code",updatable=false,insertable=false)
	private Area districtEntity;
	
	@OneToOne(fetch=FetchType.LAZY,cascade=CascadeType.REFRESH)
	@JoinColumn(name="user_id",updatable=false,insertable=false)
	private User user;
	
	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}
	
	public Long getActivityId() {
		return activityId;
	}

	public void setActivityId(Long activityId) {
		this.activityId = activityId;
	}

	public String getCancelReason() {
		return cancelReason;
	}

	public void setCancelReason(String cancelReason) {
		this.cancelReason = cancelReason;
	}

	public Date getCancelTime() {
		return cancelTime;
	}

	public void setCancelTime(Date cancelTime) {
		this.cancelTime = cancelTime;
	}

	public AuditStatusEnum getAuditStatus() {
		return auditStatus;
	}

	public void setAuditStatus(AuditStatusEnum auditStatus) {
		this.auditStatus = auditStatus;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getAuditTime() {
		return auditTime;
	}

	public void setAuditTime(Date auditTime) {
		this.auditTime = auditTime;
	}

	public String getAuditUser() {
		return auditUser;
	}

	public void setAuditUser(String auditUser) {
		this.auditUser = auditUser;
	}

	public String getAuditDescription() {
		return auditDescription;
	}

	public void setAuditDescription(String auditDescription) {
		this.auditDescription = auditDescription;
	}

	public Date getApplicationTime() {
		return applicationTime;
	}

	public void setApplicationTime(Date applicationTime) {
		this.applicationTime = applicationTime;
	}

	public Area getProvinceEntity() {
		return provinceEntity;
	}

	public void setProvinceEntity(Area provinceEntity) {
		this.provinceEntity = provinceEntity;
	}

	public Area getCityEntity() {
		return cityEntity;
	}

	public void setCityEntity(Area cityEntity) {
		this.cityEntity = cityEntity;
	}

	public Area getDistrictEntity() {
		return districtEntity;
	}

	public void setDistrictEntity(Area districtEntity) {
		this.districtEntity = districtEntity;
	}

}

